#ifndef SHADER_H_
#define SHADER_H_

#include <d3dx9.h>

#define PIXEL_SHADER 0
#define VERTEX_SHADER 1

class CShader
{
private:
	int m_nType;
	IDirect3DDevice9* m_pDevice;
	IDirect3DPixelShader9* m_pPixelShader;
	IDirect3DVertexShader9* m_pVertexShader;
	ID3DXConstantTable* m_pConstantTable;

public:
	CShader();
	~CShader();

	void Init(IDirect3DDevice9* dev, const char* szFileName, int nType);

	D3DXHANDLE GetConstant(char* szName);

	void SetFloat(D3DXHANDLE h, float f);
	void SetVector3(D3DXHANDLE h, D3DXVECTOR3 v);
	void SetVector4(D3DXHANDLE h, D3DXVECTOR4 v);
	void SetMatrix(D3DXHANDLE h, D3DXMATRIX m);

	void Begin();
	void End();
};
#endif
